/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DBL;
import java.sql.*;

/**
 *
 * @author Peter
 */
public class GetMax
{
    public GetMax(){}

    public static int getNextID(String query)
    {
        Connection con = DBConnection.getInstance().getDBcon();
        int id = -1;
        ResultSet results;
        try
        {
            Statement state = con.createStatement();
            results = state.executeQuery(query);
            if(results.next())
            {
                id = results.getInt(1);
            }
            state.close();
        }
        catch (Exception e)
        {
            System.out.println("ERROR:: " + e);
        }
        return id;
    }
}
